<?php
/**
 * User: aka
 * Time: 13:38
 */

namespace app\get\controller;


use think\Request;

class ChatRoom
{
    public function getChatContent(Request $request)
    {
        $chatLastId = $request->param('chat_last_id');
        $chatContent = \app\secret\model\ChatRoom::where('id', '=', $chatLastId)
            ->order('id desc')->limit(1)->select()->each(
                function($item)
                {
                    $item->user_id = \app\secret\model\Users::userInfo($item->user_id)
                        ->find();
                    $item->ip = get_ip_city($item->ip);
                }
            );
        return json($chatContent);
    }
}